package cliente;


import elementos.*;
import java.awt.Graphics;


public class Renderer extends Thread{
    private Composite scene;
    private Principal applet;
    private Graphics g;
    private boolean stopping = false;
    
    public Renderer(Composite s,Principal a){
        scene=s;
        applet=a;
        g=applet.getVjuego().getDoblebuffer().getGraphics();
    }
    
    public void exit(){
        stopping=true;
    }
    
    public void run() {
        while (!stopping) {
            try {
                //Graphics2D g2=(Graphics2D)g;
                g.clearRect(0, 0, applet.getWidth(), applet.getHeight());
                scene.render(g);
                applet.repaint();
                //applet.requestFocus();
                sleep(10); 
            } catch (InterruptedException ex) {
                
            }
        }
    }
    
}
